<?php

ob_start();
$main = file_get_contents('template/main.html');
$part = file_get_contents('template/add.phieuthu.php');
include 'connect/connect.php';
$result = mysql_query('SELECT * FROM tbl_giangvien');
$result2 = mysql_query('SELECT * FROM tbl_lop');
$s = '<option value=0 select>Chưa sắp lớp</option>
';
while ($row = mysql_fetch_array($result)) {
  $s = $s . '
<option value=' . $row['id'] . '>' . $row['f_hovaten'] . '</option>
';
}

$s2='';
while ($row2 = mysql_fetch_array($result2)) {
  $s2 = $s2 . '
<option value=' . $row2['f_lop'] . '>' . $row2['f_lop'] . '</option>
';
}
$thaythe = '
<select name="f_giangvien">' . $s . '</select>
';

$part = str_replace('{giangvien}', $thaythe, $part);
$part = str_replace('{lop}', $s2, $part);
$part = str_replace('{nguoitao}', $_SESSION['user_id'], $part);
$change = array('{header}', '{body}');
$changer = array('Banner', $part);
echo str_replace($change, $changer, $main);
?>